#include<bits/stdc++.h>
#define int long long 
using namespace std;
namespace IO{
    char buff[1<<21],*p1=buff,*p2=buff;
    char getch(){
        return p1==p2&&(p2=((p1=buff)+fread(buff,1,1<<21,stdin)),p1==p2)?EOF:*p1++;
    }
    template<typename T>
    void read(T &x){
        char ch=getch();int fl=1;x=0;
        while(ch>'9'||ch<'0'){if(ch=='-')fl=-1;ch=getch();}
        while(ch<='9'&&ch>='0'){x=x*10+ch-48;ch=getch();}
        x*=fl;
    }
    template<typename T,typename ...Args>
    void read(T &x,Args& ...args){
        read(x);read(args...);
    }
    char obuf[1<<21],*p3=obuf;
    void putch(char ch){
        if(p3-obuf<(1<<21))*p3++=ch;
        else fwrite(obuf,p3-obuf,1,stdout),p3=obuf,*p3++=ch;
    }
    char ch[100];
    template<typename T>
    void write(T x){
        if(!x)return putch('0');
        if(x<0)putch('-'),x*=-1;
        int top=0;
        while(x)ch[++top]=x%10+48,x/=10;
        while(top)putch(ch[top]),top--;
    }
    template<typename T,typename ...Args>
    void write(T x,Args ...args){
        write(x);write(args...);
    }
    void flush(){fwrite(obuf,p3-obuf,1,stdout);}
}
using namespace IO;
const int N=85,M=2e5;
int n,m,ans;
int f[N][M+5],g[M+5];
struct node{
	int c,v,w;
}p[N];
signed main(){
	freopen("book.in","r",stdin);
	freopen("book.out","w",stdout);
	read(n);
	for(int i=1;i<=n;i++)read(p[i].c);
	for(int i=1;i<=n;i++)read(p[i].v);
	for(int i=1;i<=n;i++)read(p[i].w);
	sort(p+1,p+n+1,[](node A,node B){return A.w*B.v<B.w*A.v;});
	for(int i=1;i<=n;i++){
		for(int j=0;j<=M;j++)g[j]=f[i-1][j];
		int x=log2(p[i].c+1),s=p[i].c-(1<<x)+1;
		for(int k=0;k<x;k++)
			for(int j=M;j>=(1<<k)*p[i].v;j--)
				g[j]=max(g[j],g[j-(1<<k)*p[i].v]+(1<<k)*p[i].w);
		for(int j=M;j>=s*p[i].v;j--)
			g[j]=max(g[j],g[j-s*p[i].v]+s*p[i].w);
		for(int j=0;j<=M;j++)f[i][j]=g[j];
	}
	read(m);
	int now=0;
	for(int i=n;i>=1;i--){
		for(int j=0;j<=min(M,m);j++)
			ans=max(ans,now+f[i-1][j]+min(((m-j)/p[i].v),p[i].c)*p[i].w);
		int x=min(m/p[i].v,p[i].c);
		now+=x*p[i].w;
		m-=x*p[i].v;
	}
	ans=max(ans,now);
	write(ans);
	flush();
	return 0;
}

